import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

Vue.config.productionTip = false;

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);
//引入使用element-ui

// import axios from "axios";
// Vue.prototype.$axios = axios;

import axios from "axios";

axios.defaults.baseURL = "https://www.liulongbin.top:8888/api/private/v1/";
// 配置请求的根路径
axios.interceptors.request.use((config) => {
  // console.log(config)
  config.headers.Authorization = localStorage.getItem("token");
  //在拦截时在请求头信息中拼上一个授权字段 是我们存在本地存储中的token
  // 在最后必须 return config
  return config;
});
//请求拦截 作用是在请求接口的时候 拼接token
Vue.prototype.$http = axios;
//把axios挂载在原型上 起名字是$http

import Vant from "vant";
import "vant/lib/index.css";

Vue.use(Vant);

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
